// VirSKDlg.h : header file
//

#if !defined(AFX_VIRSKDLG_H__E7968812_DBCC_4273_95E8_4B29C21FE9CC__INCLUDED_)
#define AFX_VIRSKDLG_H__E7968812_DBCC_4273_95E8_4B29C21FE9CC__INCLUDED_

#include "COM\COM.H"	// Added by ClassView
#include "afxcmn.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CVirSKDlg dialog

enum {
    STA_IDLE,
    STA_OPEN_DEVICE,
    STA_RUNNING,
    STA_ERROR = 1000
};


enum {
    TM_CONNECT_VPC = 1001,
    TM_CONNECT_VBOX,
    TM_EXCEL_LOAD,
    TM_PROTOCOL,    
    TM_TIMEOUT,
    TM_PS_BASE=1200
};


typedef struct tag_setting
{
    CString strExcel;
    int     com_min;
    int     com_max;
    int     idx_com_vbox;
    int     idx_com_vpc;
    int     bps;   
}DLG_SETTING;


class CAboutDlg : public CDialog , public CProtocl
{
public:
    CProtocl  m_prot;
    CRect     m_rPos;
    virtual int Parse(void);
public:
    CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	CHexEdit    m_edit;
	int		m_nPort;
	int		m_nIdxBps;
	CString	m_strRxData;
	BOOL	m_bHexView;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	afx_msg void OnBtnConnect();
	afx_msg void OnBtnClear();
	virtual BOOL OnInitDialog();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnCheckStyle();
	afx_msg void OnBtnLog();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

class CVirSKDlg : public CDialog
{
// Construction
public:
	CTerminal m_ComVBox;
    CServer m_ComVPC; 
    int  m_SetChange;
	BOOL m_bDevStatus;
    void OnDataCheckRx(CProtocl * pcom);
	void SetStatusStr(LPCTSTR strStatu);
	CVirSKDlg(CWnd* pParent = NULL);	// standard constructor
    void   OnOpenButton()   ;

// Dialog Data
	//{{AFX_DATA(CVirSKDlg)
	enum { IDD = IDD_VIRSK_DIALOG };
	CListCtrl	m_oListCmd;
	CString	m_txtVbox;
	CString	m_txtVPC;
	int		m_nIdxComVbox;
	int		m_nIdxComVpc;
	int		m_nIdxBps;
    BOOL m_bEnSimPC;
    BOOL m_bEnSimBox;
    CListCtrl m_oListVPC;
    CListCtrl m_oListVBox;
	CString	m_strExcelName;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CVirSKDlg)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CVirSKDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg LRESULT OnPsShowText(WPARAM wp, LPARAM lp);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnBtnRun();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnBtnSelExcelFile();
	afx_msg void OnDestroy();
	afx_msg void OnDblclkListVpcCmd(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnBtnComtest();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
    afx_msg void OnBnClickedChkVpc();
public:
    afx_msg void OnBnClickedChkVbox();
public:
	CString m_strIniFile;
	void InitListCtrl();
	void InitDlgDatas();
	void SaveSeting();
private:
	void LoadSeting(DLG_SETTING * setting);
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_VIRSKDLG_H__E7968812_DBCC_4273_95E8_4B29C21FE9CC__INCLUDED_)
